package com.spring.framework.aop.annotation.hello;

import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

/**
 * 启动类
 *
 * @author xuweizhi
 * @since 2020/12/16 15:08
 */
@Configuration
@EnableAspectJAutoProxy
@ComponentScan(basePackages = "com.spring.framework.aop.annotation.hello")
public class AnnotationConfig {

	@Test
	public void firstAnnotationTest(){
		//1 获取容器
		AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext(AnnotationConfig.class);
		//2 获取bean
		FirstAopAnnotationTarget ft = ac.getBean("firstAopAnnotationTarget", FirstAopAnnotationTarget.class);
		//3 调用目标方法
		ft.target();
	}


}
